In recent years, a program language such as an object oriented language has been commonly used in order to reduce burdens on programmers and to improve the robustness, maintainability, and the like of programs. Compilers translate a program described in a program language into a machine language; they generally carry out various types of optimization in order to increase the speed at which the program is executed.
The following documents are considered:
[Patent Document 1]
Published Unexamined Patent Application No. 2002-259135.
[Non-patent Document 1]                Nobuhisa FUJINAMI, “Run-time Optimization for Object Oriented Language”, Theses from Twelfth Conference of Japanese Software Science, September 1995, pp. 245 to 248.        
[Non-patent Document 2]
Motohiro KAWAHITO, Hideaki KOMATSU, and Toshio NAKATANI, “Technique to Optimize Speculative Memory Accesses to Java® Language”, Journal of the Information Processing Society of Japan, Vol. 44, No. 3, pp. 883 to 896, 2003 (Java® is a registered trade mark).,
As an optimization that increases the execution speed for a program, a technique has been proposed which specializes a part of the program for a process executed if a variable referenced by the program has a particular value. For example, a technique has been proposed which operates for each method in a program to determine whether or not a variable has a particular value every time the method is called so that the program branches to a specialized series of instructions and a non-specialized series of instructions (see Patent Document 1).
Another technique has been used; for a private variable used only in an object, if it is known that a value is substituted into the variable only when the object is generated, all the methods in the object which use the variable are compiled by specialization (see Non-patent Document 1). Non-patent Document 2 will be described later.
According to the technique in Patent Document 1, the compiler generates an instruction to determine whether or not the variable has a particular value, at the beginning of processing executed by the method. Thus, every time the method is called, this determining process is executed. However, once it has been determined whether or not the variable has the particular value, this determination need no longer be executed unless the value of the variable is subsequently updated. Thus, unwanted determining processes may be executed.
Moreover, with this technique, only if the processing time reduced by specialization exceeds the processing time required to determine whether or not the variable has the particular value, the compiler determines that the efficiency of the entire program will be improved and then compiles the program by specialization. Consequently, the processing time required for unwanted determining processes may prevent the program from being appropriately specialized.
According to Non-patent Document 1, even if the particular value is likely to be substituted into the variable, the compiler cannot execute optimization unless it is ensured that the value is substituted into the variable. Thus, the optimization may not be appropriately executed even if the specialization is to improve execution efficiency.